#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include <iostream>
using namespace std;
int w = 0;
int main() {
    cin >> w;
    int a; int b; int c;
    while (w--)
    {
        cin >> a >> b >> c;
        int x = min(a, min(b, c));
        int y = max(b - x - 1, 0);
        int as = x * 2 + y;
        cout << as << endl;

    }
}
